package com.hdcx.Minfresh.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.hdcx.Minfresh.R;


public class WelcomeActivity extends Activity implements Runnable {

    private static final int sleepTime = 1500;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);

        //启动一个延迟线程
         new Thread(this).start();
    }

    public void run() {
        try {
            //延迟两秒
            Thread.sleep(sleepTime);
            //读取SharedPreferences中需要的数据
            /**
             *如果用户不是第一次使用则直接调转到显示界面,否则调转到引导界面
             */
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
                startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
//                startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
            finish();

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }




}
